Is there a way to do a sector level copy/clone from one hard drive to another?
Solution 1
In linux the dd command can do what you want.
https://serverfault.com/questions/4906/using-dd-for-disk-cloning
Just make sure not to clone the empty drive onto the drive you want to clone.
Solution 2
If you want to it fast... then dd
is not what you want. Why?
Because it is single-threaded. It means, it works on this way:
- reads a block from the source, waits until it is ready
- writes this block to the target, waits until ready
- goto 1
Actually, the writing and the reading of the next block could happen in the same time, but dd can't do that.
To do quick backups, you can use the buffer tool. Similarly to the dd
, it works basically from standard input to standard output, so you can use it in a pipe, to make its two site really parallel working.
The parametrization which would you probably most like:
buffer -i /dev/sdX -o /dev/sdY -s 8192 -b 2048
It will clone /dev/sdX
to /dev/sdY
, quickly.
You can also use buffer
to accelerate any piped shell command:
pipe-chain-commands1 | buffer -s 8192 -b 2048 | pipe-chain-commands2
This will result that the first chain should not wait until the second chain doesn't eat its output.
Related videos on Youtube
user1408682
Updated on September 17, 2022Comments
-
user1408682 over 1 year
I was wondering could anyone could review my production Hibernate configuration and let me know if I am missing anything or give me any hints with easily improving performance for a production enviroment
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> </property> <property name="jpaProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">verify</prop> <prop key="hibernate.connection.pool_size">10</prop> <prop key="hibernate.current_session_context_class">thread</prop> </props> </property> </bean>
Basically I am wondering if this configuration will cause connection pooling issues and should I start using c3p0
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="jpaVendorAdapter"> <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /> </property> <property name="jpaProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">verify</prop> <prop key="hibernate.connection.pool_size">10</prop> <prop key="hibernate.current_session_context_class">thread</prop> <prop key="hibernate.c3p0.acquire_increment">1</prop> <prop key="hibernate.c3p0.min_size">5</prop> <prop key="hibernate.c3p0.max_size">20</prop> <prop key="hibernate.c3p0.timeout">300</prop> <prop key="hibernate.c3p0.max_statements">50</prop> <prop key="hibernate.c3p0.idle_test_period">3000</prop> </props> </property> </bean>
And if so is this the correct way to configure c3p0
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>Reservosity</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <properties> <org.springframework.version>3.1.1.RELEASE</org.springframework.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>2.2.8</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.20</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.6.10.Final</version> </dependency> <dependency> <groupId>com.github.jsimone</groupId> <artifactId>webapp-runner</artifactId> <version>7.0.27.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>c3p0</groupId> <artifactId>c3p0</artifactId> <version>0.9.1.2</version> </dependency> <!-- Tiles dependency --> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-core</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-jsp</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-api</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-servlet</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-template</artifactId> <version>2.2.1</version> </dependency> <!-- Security --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>3.1.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>3.1.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>3.1.3.RELEASE</version> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>4.3.1.Final</version> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.1</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> <version>1.9.11</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.github.jsimone</groupId> <artifactId>webapp-runner</artifactId> <version>7.0.27.1</version> <destFileName>webapp-runner.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build>
-
Neetu almost 14 yearsAwesome! glad to hear it worked.
-
László van den Hoek over 11 yearsThere's not really a question in there. Do you have a particular problem? If so, what have you tried to solve it?
-
user1408682 over 11 yearsSorry Laszlo having connection pooling issues org.hibernate.exception.GenericJDBCException: Cannot release connection wondering should I implement c3p0 and if i am doing it right in my pom.xml and jpa and hibernate configuration? Also I was wondering how do I test c3p0 if its working?
-
-
8bittree about 10 yearsIt should be noted that
dd
is also a Mac OS X command.