Using/dev/zero to create a virtual hard disk/dev/zero is a special device in Linux. every time you read it, it outputs a byte (in the editor, all of them are 0 ), now let's create a 10 m data file and run the file command to view [root @ xx ~] # Ddif...
Using/dev/zero to create a virtual hard disk/dev/zero is a special device in Linux, each time you read it, it outputs a byte (all of them are "0" in the editor). now we can create a 10 m data file, then run the file command to view [root @ xx ~]. # Dd if =/dev/zero of = hd. img bs = 1 k count = 10000 [root @ xx ~] # File hd. img the file command hd. img is a data file. now we use loop device to mount it into a virtual hard disk [root @ xx ~] # Losetup/dev/loop1 hd. img [root @ xx ~] # Losetup-a www.2cto.com, hd. img corresponds to loop1. now we can use/dev/loop1 to operate hd. img, which is like a real device. it can be used for partitioning, file system creation, and other [root @ xx ~] # Fdisk/dev/loop1 use fdisk for partitioning, create a file system, and view the attributes of hd. img with file [root @ xx ~] # Mkfs-t ext2/dev/loop1 [root @ xx ~] # File hd. img of course, the last step is to mount the author mudan88
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.